﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Empires.Infrastructure.Entities.Repository;

namespace Empires.Infrastructure.Entities.Entity
{
    public class BlockSegment : IAccessible<T_BlockSegment, BlockSegment>, ILogicEntity<T_BlockSegment, BlockSegment>
    {
        public int Id { get; set; }
        public int TempId { get; set; }
        public string BlockName { get; set; }
        public string Segment { get; set; }

        protected override void Covariant(T_BlockSegment model)
        {
            if (model != null)
            {
                this.Id = model.Id;
                this.TempId = model.TempId;
                this.BlockName = model.BlockName;
                this.Segment = model.Segment;
            }
        }

        protected override T_BlockSegment Inverter(BlockSegment model)
        {
            if (model != null)
            {
                return new T_BlockSegment()
                {
                    BlockName = model.BlockName,
                    Id = model.Id,
                    Segment = model.Segment,
                    TempId = model.TempId
                };
            }
            return null;
        }

        public BlockSegment Set(T_BlockSegment dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
